<?php
/*
# ------------------------------------------------------------------------
# JA Teline III - Version 1.3 - Licence Owner jSharing.COM
# ------------------------------------------------------------------------
# Copyright (C) Lifetime Joomla Just for Sharing, Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: Joomla Just for Sharing
# Websites:  http://jsharing.com -  http://jsharing.net
# This file may not be redistributed in whole or significant part.
# ------------------------------------------------------------------------
*/
//Disqus config
$subdomain      = $this->plgParams->get('provider-disqus-subdomain');
$devmode        = $this->plgParams->get('provider-disqus-devmode',0);

$devcode = "";
if ($devmode) 
	$devcode = "var disqus_developer = \"1\";";

$sefUrl = $this->_url;
$sefUrl = JA_MakeSefUrl( $this->_url );
if ($this->isComment == false) {
?>
	<div class="jacomment-count"><a class="jacomment-counter" onclick="location.href='<?php echo $this->_url; ?>#disqus_thread'; return false;" href="<?php echo $sefUrl; ?>#disqus_thread" title="<?php echo JText::_("COMMENTS"); ?>"><?php echo JText::_("COMMENTS"); ?></a></div>
	<?php 
		if (!defined('JACOMMENT_COUNT')) :
			define('JACOMMENT_COUNT',true);
                $countScript = "
                <script type='text/javascript'>
				//<![CDATA[ 
				window.addEvent('domready', function(){
					var links = $$('a.jacomment-counter');
					var query = '?';
					for(var i = 0; i < links.length; i++) {
						query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
					}
					Asset.javascript('http://disqus.com/forums/".$subdomain."/get_num_replies.js' + query + '', {charset: 'utf-8'});
                });
				//]]> 
                </script>";
			$this->document->addCustomTag($countScript);
		endif; 
} else {
	?>
	<div id="disqus_thread"></div>
	<script type="text/javascript">
		//<![CDATA[
		<?php echo $devcode?>
		
		var disqus_url= "<?php echo $sefUrl; ?>";
		var disqus_identifier = "<?php echo $this->_postid ?>";
		//]]>
	</script>            
	<script type="text/javascript" src="http://disqus.com/forums/<?php echo $subdomain?>/embed.js"></script>
	<noscript><a href="http://<?php echo $subdomain?>.disqus.com/?url=ref"><?php echo JText::_("VIEW THE DISCUSSION THREAD."); ?></a></noscript>
	<a href="http://disqus.com" class="dq-powered"><?php echo JText::_("BLOG COMMENTS POWERED BY DISQUS"); ?></a>
<?php } ?>